home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / FindByContent.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  8.3 KB  |  307 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        FindByContent.h
  3.  
  4.      Contains:    Public search interface for the Find by Content shared library
  5.  
  6.      Version:    Technology:    2.0
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1997-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __FINDBYCONTENT__
  18. #define __FINDBYCONTENT__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __FILES__
  25.     #include <Files.h>
  26. #endif
  27.  
  28. #ifndef __MACERRORS__
  29.     #include <MacErrors.h>
  30. #endif
  31.  
  32.  
  33.  
  34.  
  35. #if PRAGMA_ONCE
  36. #pragma once
  37. #endif
  38.  
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42.  
  43. #if PRAGMA_IMPORT
  44. #pragma import on
  45. #endif
  46.  
  47. #if PRAGMA_STRUCT_ALIGN
  48.     #pragma options align=mac68k
  49. #elif PRAGMA_STRUCT_PACKPUSH
  50.     #pragma pack(push, 2)
  51. #elif PRAGMA_STRUCT_PACK
  52.     #pragma pack(2)
  53. #endif
  54.  
  55. /*
  56.    ***************************************************************************
  57.    Phase values
  58.    These values are passed to the client's callback function to indicate what
  59.    the FBC code is doing.
  60.    ***************************************************************************
  61. */
  62. enum {
  63.                                                                 /* indexing phases*/
  64.     kFBCphIndexing                = 0,
  65.     kFBCphFlushing                = 1,
  66.     kFBCphMerging                = 2,
  67.     kFBCphMakingIndexAccessor    = 3,
  68.     kFBCphCompacting            = 4,
  69.     kFBCphIndexWaiting            = 5,                            /* access phases*/
  70.     kFBCphSearching                = 6,
  71.     kFBCphMakingAccessAccessor    = 7,
  72.     kFBCphAccessWaiting            = 8,                            /* summarization*/
  73.     kFBCphSummarizing            = 9,                            /* indexing or access*/
  74.     kFBCphIdle                    = 10,
  75.     kFBCphCanceling                = 11
  76. };
  77.  
  78.  
  79.  
  80. /*
  81.    ***************************************************************************
  82.    Pointer types
  83.    These point to memory allocated by the FBC shared library, and must be deallocated
  84.    by calls that are defined below.
  85.    ***************************************************************************
  86. */
  87.  
  88. /* A collection of state information for searching*/
  89. typedef struct OpaqueFBCSearchSession*     FBCSearchSession;
  90. /* An ordinary C string (used for hit/doc terms)*/
  91. typedef char *                            FBCWordItem;
  92. /* An array of WordItems*/
  93. typedef FBCWordItem *                    FBCWordList;
  94. /*
  95.    ***************************************************************************
  96.    Callback function type for progress reporting and cancelation during
  97.    searching and indexing.  The client's callback function should call
  98.    WaitNextEvent; a "sleep" value of 1 is suggested.  If the callback function
  99.    wants to cancel the current operation (indexing, search, or doc-terms
  100.    retrieval) it should return true.
  101.    ***************************************************************************
  102. */
  103.  
  104. typedef CALLBACK_API_C( Boolean , FBCCallbackProcPtr )(UInt16 phase, float percentDone, void *data);
  105. /*
  106.    ***************************************************************************
  107.    Set the callback function for progress reporting and cancelation during
  108.    searching and indexing, and set the amount of heap space to reserve for
  109.    the client's use when FBC allocates memory.
  110.    ***************************************************************************
  111. */
  112. EXTERN_API_C( void )
  113. FBCSetCallback                    (FBCCallbackProcPtr     fn,
  114.                                  void *                    data);
  115.  
  116. EXTERN_API_C( void )
  117. FBCSetHeapReservation            (UInt32                 bytes);
  118.  
  119. /*
  120.    ***************************************************************************
  121.    Find out whether a volume is indexed, the date & time of its last
  122.    completed  update, and its physical size.
  123.    ***************************************************************************
  124. */
  125.  
  126. EXTERN_API_C( Boolean )
  127. FBCVolumeIsIndexed                (SInt16                 theVRefNum);
  128.  
  129. EXTERN_API_C( Boolean )
  130. FBCVolumeIsRemote                (SInt16                 theVRefNum);
  131.  
  132. EXTERN_API_C( OSErr )
  133. FBCVolumeIndexTimeStamp            (SInt16                 theVRefNum,
  134.                                  UInt32 *                timeStamp);
  135.  
  136. EXTERN_API_C( OSErr )
  137. FBCVolumeIndexPhysicalSize        (SInt16                 theVRefNum,
  138.                                  UInt32 *                size);
  139.  
  140. /*
  141.    ***************************************************************************
  142.    Create & configure a search session
  143.    ***************************************************************************
  144. */
  145.  
  146. EXTERN_API_C( OSErr )
  147. FBCCreateSearchSession            (FBCSearchSession *        searchSession);
  148.  
  149. EXTERN_API_C( OSErr )
  150. FBCAddAllVolumesToSession        (FBCSearchSession         theSession,
  151.                                  Boolean                 includeRemote);
  152.  
  153. EXTERN_API_C( OSErr )
  154. FBCSetSessionVolumes            (FBCSearchSession         theSession,
  155.                                  const SInt16             vRefNums[],
  156.                                  UInt16                 numVolumes);
  157.  
  158. EXTERN_API_C( OSErr )
  159. FBCAddVolumeToSession            (FBCSearchSession         theSession,
  160.                                  SInt16                 vRefNum);
  161.  
  162. EXTERN_API_C( OSErr )
  163. FBCRemoveVolumeFromSession        (FBCSearchSession         theSession,
  164.                                  SInt16                 vRefNum);
  165.  
  166. EXTERN_API_C( OSErr )
  167. FBCGetSessionVolumeCount        (FBCSearchSession         theSession,
  168.                                  UInt16 *                count);
  169.  
  170. EXTERN_API_C( OSErr )
  171. FBCGetSessionVolumes            (FBCSearchSession         theSession,
  172.                                  SInt16                 vRefNums[],
  173.                                  UInt16 *                numVolumes);
  174.  
  175. EXTERN_API_C( OSErr )
  176. FBCCloneSearchSession            (FBCSearchSession         original,
  177.                                  FBCSearchSession *        clone);
  178.  
  179. /*
  180.    ***************************************************************************
  181.    Execute a search
  182.    ***************************************************************************
  183. */
  184.  
  185. EXTERN_API_C( OSErr )
  186. FBCDoQuerySearch                (FBCSearchSession         theSession,
  187.                                  char *                    queryText,
  188.                                  const FSSpec             targetDirs[],
  189.                                  UInt32                 numTargets,
  190.                                  UInt32                 maxHits,
  191.                                  UInt32                 maxHitWords);
  192.  
  193. EXTERN_API_C( OSErr )
  194. FBCDoExampleSearch                (FBCSearchSession         theSession,
  195.                                  const UInt32 *            exampleHitNums,
  196.                                  UInt32                 numExamples,
  197.                                  const FSSpec             targetDirs[],
  198.                                  UInt32                 numTargets,
  199.                                  UInt32                 maxHits,
  200.                                  UInt32                 maxHitWords);
  201.  
  202. EXTERN_API_C( OSErr )
  203. FBCBlindExampleSearch            (FSSpec                 examples[],
  204.                                  UInt32                 numExamples,
  205.                                  const FSSpec             targetDirs[],
  206.                                  UInt32                 numTargets,
  207.                                  UInt32                 maxHits,
  208.                                  UInt32                 maxHitWords,
  209.                                  Boolean                 allIndexes,
  210.                                  Boolean                 includeRemote,
  211.                                  FBCSearchSession *        theSession);
  212.  
  213.  
  214. /*
  215.    ***************************************************************************
  216.    Get information about hits [wrapper for THitItem C++ API]
  217.    ***************************************************************************
  218. */
  219.  
  220. EXTERN_API_C( OSErr )
  221. FBCGetHitCount                    (FBCSearchSession         theSession,
  222.                                  UInt32 *                count);
  223.  
  224. EXTERN_API_C( OSErr )
  225. FBCGetHitDocument                (FBCSearchSession         theSession,
  226.                                  UInt32                 hitNumber,
  227.                                  FSSpec *                theDocument);
  228.  
  229. EXTERN_API_C( OSErr )
  230. FBCGetHitScore                    (FBCSearchSession         theSession,
  231.                                  UInt32                 hitNumber,
  232.                                  float *                score);
  233.  
  234. EXTERN_API_C( OSErr )
  235. FBCGetMatchedWords                (FBCSearchSession         theSession,
  236.                                  UInt32                 hitNumber,
  237.                                  UInt32 *                wordCount,
  238.                                  FBCWordList *            list);
  239.  
  240. EXTERN_API_C( OSErr )
  241. FBCGetTopicWords                (FBCSearchSession         theSession,
  242.                                  UInt32                 hitNumber,
  243.                                  UInt32 *                wordCount,
  244.                                  FBCWordList *            list);
  245.  
  246.  
  247. /*
  248.    ***************************************************************************
  249.    Summarize a buffer of text
  250.    ***************************************************************************
  251. */
  252.  
  253. EXTERN_API_C( OSErr )
  254. FBCSummarize                    (void *                    inBuf,
  255.                                  UInt32                 inLength,
  256.                                  void *                    outBuf,
  257.                                  UInt32 *                outLength,
  258.                                  UInt32 *                numSentences);
  259.  
  260. /*
  261.    ***************************************************************************
  262.    Deallocate hit lists, word arrays, and search sessions
  263.    ***************************************************************************
  264. */
  265.  
  266. EXTERN_API_C( OSErr )
  267. FBCReleaseSessionHits            (FBCSearchSession         theSession);
  268.  
  269. EXTERN_API_C( OSErr )
  270. FBCDestroyWordList                (FBCWordList             theList,
  271.                                  UInt32                 wordCount);
  272.  
  273. EXTERN_API_C( OSErr )
  274. FBCDestroySearchSession            (FBCSearchSession         theSession);
  275.  
  276. /*
  277.    ***************************************************************************
  278.    Index one or more files and/or folders
  279.    ***************************************************************************
  280. */
  281.  
  282. EXTERN_API_C( OSErr )
  283. FBCIndexItems                    (FSSpecArrayPtr         theItems,
  284.                                  UInt32                 itemCount);
  285.  
  286.  
  287. #if PRAGMA_STRUCT_ALIGN
  288.     #pragma options align=reset
  289. #elif PRAGMA_STRUCT_PACKPUSH
  290.     #pragma pack(pop)
  291. #elif PRAGMA_STRUCT_PACK
  292.     #pragma pack()
  293. #endif
  294.  
  295. #ifdef PRAGMA_IMPORT_OFF
  296. #pragma import off
  297. #elif PRAGMA_IMPORT
  298. #pragma import reset
  299. #endif
  300.  
  301. #ifdef __cplusplus
  302. }
  303. #endif
  304.  
  305. #endif /* __FINDBYCONTENT__ */
  306.  
  307.